import spock.lang.Specification

/**
 * Created at 2017/10/14 19:09
 * @author gongweixin
 */
class IfExample extends Specification {
    def "test null"() {
        expect:
        false == null as boolean
    }

    def "test empty String "() {
        expect:
        false == '' as boolean
    }

    def "test blank String "() {
        expect:
        true == ' ' as boolean
    }

    def "test String "() {
        expect:
        true == 'asdf' as boolean
    }

    def "test ?." () {
        expect:
        false == [:][""]?.contains("") as boolean
    }

    def "test 0"() {
        expect:
        false == 0 as boolean
        true == 1 as boolean
        true == -1 as boolean
    }
}
